package com.firexxx.vp.infrastructure.configuration;

import com.firexxx.common.domain.query.QueryRegistry;
import com.firexxx.vp.domain.audio.query.AudioQueryInterface;
import com.firexxx.vp.domain.stb.query.StbQueryInterface;
import com.firexxx.vp.domain.vp.fuse.query.FuseVoicePrintQueryInterface;
import com.firexxx.vp.domain.vp.query.VoicePrintModelQueryInterface;
import com.firexxx.vp.domain.vp.single.query.SingleVoicePrintQueryInterface;
import com.firexxx.vp.infrastructure.query.impl.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @description: TODO
 * @throws:
 * @author: zhuangzhang2
 * @date: 2020/02/12 18:04
 */
@Configuration
public class QueryModelConfiguration {

    //private List<>

    //audio查询使用mysql
    @Bean
    public AudioQueryInterface audioQueryInterface() {
        AudioQueryInterface audioQueryInterface = new BaseAudioService();
        QueryRegistry.addBean(AudioQueryInterface.class, audioQueryInterface);
        return audioQueryInterface;
    }

    //single voice print查询使用mysql
    @Bean
    public SingleVoicePrintQueryInterface singleVoicePrintQueryInterface() {
        SingleVoicePrintQueryInterface singleVoicePrintQueryInterface = new BaseSingleVoicePrintQuery();
        QueryRegistry.addBean(SingleVoicePrintQueryInterface.class, singleVoicePrintQueryInterface);
        return singleVoicePrintQueryInterface;
    }

    //fuse voice print查询使用redis
    @Bean
    public FuseVoicePrintQueryInterface fuseVoicePrintQueryInterface() {
        FuseVoicePrintQueryInterface fuseVoicePrintQueryInterface = new BaseFuseVoicePrintQuery();
        QueryRegistry.addBean(FuseVoicePrintQueryInterface.class, fuseVoicePrintQueryInterface);
        return fuseVoicePrintQueryInterface;
    }

    //stb查询使用redis
    @Bean
    public StbQueryInterface stbQueryInterface() {
        StbQueryInterface stbQueryInterface = new StbRedisCache();
        QueryRegistry.addBean(StbQueryInterface.class, stbQueryInterface);
        return stbQueryInterface;
    }

    //vioce print model查询使用redis
    @Bean
    public VoicePrintModelQueryInterface voicePrintModelQueryInterface() {
        VoicePrintModelQueryInterface voicePrintModelQueryInterface = new VoicePrintModelRedisCache();
        QueryRegistry.addBean(VoicePrintModelQueryInterface.class, voicePrintModelQueryInterface);
        return voicePrintModelQueryInterface;
    }
}